POV-Ray : Newsgroups : povray.general : Pb and question about pigment in function using an image : Pb and question about pigment in function using an image Server Time
1 Aug 2024 00:17:52 EDT (-0400)
  Pb and question about pigment in function using an image  
From: Sylvain
Date: 29 Jun 2006 12:35:00
Message: <web.44a40092b7293f675847c8f80@news.povray.org>
Hello there,

Is it a bug or (most probable) did I miss something ?

I have this very nice image of a checker (this is just for the sake of the
example and not the image I am actually using) stored in a file called
test.pgm:
content of test.pgm:
P2
2 2
255
0 100
100 0

I am using this image in a pigment function, or whatever you might want to
call that:
#local fn_pig= function {
  pigment {
    image_map {
      pgm "test.pgm"
      map_type 0
      interpolate 0
      once
    }
  }
}
#local fn_pig_Height=function { (fn_pig(x, y, 0).red ) }

Then, I just call this function many times, using a loop:
#declare Pas = 0.1;
#declare Loc_x = 0;
#while (Loc_x < 1)
  #declare Loc_y = 0;
  #while (Loc_y < 1)
    #debug concat("x=",str(Loc_x,3,3)," y=",str(Loc_y,3,3)," fn_pig_Height =
",str(fn_pig_Height(Loc_x,Loc_y,0),5,5),"n")
    #declare Loc_y = Loc_y + Pas;
  #end
  #debug "n"
  #declare Loc_x = Loc_x + Pas;
#end

and HERE IS MY QUESTION !!! For each x value strictly lower than 1, and for
each y value stricly lower than 1 (x<1 and y<1), I get what I expect (0 or
0.39216, which is 100/255, depending on x and y). But, for x=1 and
y=anything, or for y=1 and x=anything, I get the value 1 !!
What I expected was :
for x = 0 to 0.5 and y = 1, f(x,y) = 0
for x = 0.5+ to 1.0 and y = 1, f(x,y) = 0.39216
for y = 0 to 0.5 and x = 1, f(x,y) = 0
for y = 0.5+ to 1.0 and x = 1, f(x,y) = 0.39216

Isn't the image supposed to fit exactly on a square <0,0>, <1,1> in the x-y
plane ?

I would not have been surprised to get such a value (1) for any x or y
strictly greater than 1. Is it merely a matter of machine error (meaning
that 1.0 is in fact something like 1.00000000000000000000015135) ?

When I render this as an isosurface, I get a kind of wall around my
checker...
Could anyone help me out ?

Hope my description is clear. If not, please ask for more information...

S.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.